;(function() {
		init_parsley();
	   	$("#form-submit").click(function(){
	   		var flag=$('#validate-form').parsley('validate' );
	   		if(flag){
                var start_no = $("#start_no").val();
                if (!isPositiveInteger(start_no)) {
                    toastr['error']("编号应为正整数","操作失败！");
                    return false;
                }
	   			loading();
	   			$.post(
	   				"/gym/cabinet/cabinetEdit",
	   				$("#validate-form").serialize(),
	   				function(data){
	   					close_loading();
			      		if(data.flag){
			      			$("#myModal").modal("hide");
			      			toastr['success']("操作成功！", ''); 
			      			$("#myform #btn-advanced-refresh").trigger("click");// 刷新页面
			      		}else{
			      		 	toastr['error'](data.msg,"操作失败！"); 
			      		}
	   				}
	   			);
	   		}
	   	});
    function isPositiveInteger(num) {
        var re = /^[1-9]\d*$/ ;
        return re.test(num);
    }
})();